package ruiFight.collect.controller;

//import com.ruifight.rfid.model.Manager;
//import com.ruifight.rfid.service.ManagerService;
//import com.ruifight.rfid.util.WebUtil;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

@Controller
public class LoginController {

//    @Resource
//    private ManagerService managerService;

    /**
     * @describe: 登录
     * @params:
     * @Author: Kanyun
     * @Date: 2018/1/16 0016 13:09
     */
//    @RequestMapping("/login")
//    public String login(Manager manager, RedirectAttributes redirectAttributes, HttpServletRequest request) {
//        Manager actManager = managerService.findManagerByCondition(manager);
//        if (actManager == null) {
//        	redirectAttributes.addFlashAttribute("msg", "用户名不存在");
//        	return "redirect:/backlogin";
//        } else {
//        	if(actManager.getLoginPassword().equals(manager.getLoginPassword())) {
//            	WebUtil.setSessionUser(request, actManager);
//            	return "redirect:/index";
//        	}else {
//        		redirectAttributes.addFlashAttribute("msg", "密码错误");
//        		return "redirect:/backlogin";
//        	}
//        }
//    }
//
//    /**
//     * @describe: 注销
//     * @params:
//     * @Author: Kanyun
//     * @Date: 2018/1/16 0016 16:51
//     */
//    @RequestMapping("/logout")
//    public String logout(HttpServletRequest request) {
//        WebUtil.removeSessionUser(request);
//        return "redirect:/";
//    }
//
//    @RequestMapping("/backlogin")
//    public String backLogin(@ModelAttribute("msg") String msg, Model model) {
//        model.addAttribute("msg", msg);
//        return "login";
//    }
}
